package com.future.bantang.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ScrollView;

/**
 * Created by Administrator on 16-1-14.
 */
public class BanTangScrollView extends ScrollView {
    public BanTangScrollView(Context context) {
        super(context);
    }

    public BanTangScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }



    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        return super.onTouchEvent(ev);

    }




    //是否拦截事件
    private boolean isIntercept=true;

    /**
     * 设置是否拦截事件
     * @param isIntercept
     */
    public void setIsIntercept(boolean isIntercept) {
        this.isIntercept = isIntercept;
    }

    /**
     * 获取当前是否运行拦截事件
     * @return
     */
    public boolean isIntercept() {
        return isIntercept;
    }



    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        return isIntercept?super.onInterceptTouchEvent(ev):isIntercept;
    }
}
